package com.heima.schedule.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.schedule.dto.Task;
import com.heima.schedule.service.TaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
@Api(value = "redis任务缓存接口")
public class scheduleController {

    @Autowired
    private TaskService taskService;
    @ApiOperation("添加定时任务")
    @PostMapping("/redis")
    public ResponseResult testRedis(@RequestBody Task task)
    {
        Long aLong = taskService.addTask(task);
        return ResponseResult.okResult(aLong);
    }
}
